﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using HR60_PanelSoft.View.TabForms.Handles;
using HR60_PanelSoft.Model;

namespace HR60_PanelSoft.View.TabForms.ListItems
{
	public partial class SceneLocalDeviceList : SceneDeviceList
	{
		public SceneLocalDeviceList()
		{
			InitializeComponent();
		}

		public void init(HR60_PanelSoft.Model.Panel panel)
		{
			// 负载设备列表
			foreach (Pin pin in panel.loadPins)
			{
				if (pin.isMainPin && findDeviceByUuid(pin.connectedDevice).type.canButtonCtrl)
				{
					Device dev = findDeviceByUuid(pin.connectedDevice);
					SceneDeviceItem item = new SceneDeviceItem(dev);
					if (panel.type.hasSignalModel && panel.signal.scene != null)
					{
						Scene scene = findSceneByUuid(panel.signal.scene);
						SceneEvent se = scene.findEventByDevice(dev.uuid);
						item.Value = se;
					}
				}
			}
		}
	}
}
